/**
 * @author Yunfeng Bai
 *
 * 2010-11-12
 */
package force;

import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;

import rigidbody.RigidBody;

public class SimpleForce extends Force
{
    /** The rigid body that is affected by the force. */
    private RigidBody _body;

    /** Position is in world space. */
    private Point3d _position;

    /** Direction is in world space. */
    private Vector3d _force;

    public SimpleForce(RigidBody body_, Point3d pos_, Vector3d force_)
    {
        _body = body_;
        _position = pos_;
        _force = force_;
    }

    @Override
    public void apply(double t)
    {
        _body.accumulateForce(_force);
        _body.accumulateTorque(_position, _force);
    }
}
